package com.example.demo99.Controller;

import com.example.demo99.Domian.User;
import com.example.demo99.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@CrossOrigin
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;
    @GetMapping("all")
   public List<User> getAll(String xueyuan){
        return userService.getAll(xueyuan);
    }

    @GetMapping("al")
    public User al(int id) {
        return userService.al(id);
    }
    //删除
   @PostMapping("delete")
    public String delete(@RequestBody User user) {
        return userService.delete(user.getId());
   }

   @PostMapping("edit")
    public String edit(@RequestBody User user) {
        return userService.edit(user);
   }
}
